<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:useBean id="selhome_message1" scope="session" class="software.Use_user"/>
<jsp:useBean id="selhome_message2" scope="session" class="software.Fri_done"/>
<jsp:useBean id="selhome_message3" scope="session" class="software.Mes_function"/>
 <jsp:useBean id="selhome_message4" class="software.Paination" scope="session"/>
<%@ page language="java" import="software.Mes_data"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>
        我的留言 
    </title>
    </head>
<body>
&nbsp; &nbsp; &nbsp; &nbsp; <a href="selhome_main.jsp">返回主页</a>
  <script Language="javascript">
	function openstr1(relId)
	{   
		window.showModalDialog("web/selmessage_reply_read.jsp?RelId="+relId,window,"dialogWidth=289px;dialogHeight=154px;status=no");
	}
	function openstr2(ID_Mes_rel,ID_Use_post,ID_Use_get)
	{ 
	var Value=window.showModalDialog("web/selmessage_reply_post.jsp",window,"dialogWidth=420px;dialogHeight=212px;status=no;help=0;edge=sunken");
	window.location.href("selmessage_reply_chuli.jsp?ID_Mes_Rel1="+ID_Mes_rel+"&ID_Use_Get1="+ID_Use_get+"&ID_Use_Post1="+ID_Use_post+"&content="+Value);
	}
	</script>
     <table width="1200" border="1">
	<%
	String Id;
	Id=session.getAttribute("IDsel").toString();
 	int Id1=Integer.parseInt(Id);
    selhome_message3.setId_Use_Get(Id1);
    selhome_message3.Mes_function_read();
    int k=selhome_message3.get_fun_sum_message();
    List<Mes_data> listnewmessage = new ArrayList();
    if(k==0){
    %>
   <tr><td width="1160">目前还没有留言</td></tr>
   <%
    }
   else if(k>0)
   {
    %>
    <tr align = 'center'>
      <td align="left" colspan="7">我的留言:<%=k%>条</td>
    </tr>
    <tr align = 'center'>
      <td width="739">留言内容</td>
      <td width="88">好友</td>
      <td width="88">留言时间</td>
    </tr>
    <% 
    for(int i=0;i<k;i++)
    {
    listnewmessage.add(selhome_message3.Mes_get_message(i)); 
    }
    selhome_message4.initPageBean(listnewmessage);
   }
   %>
       <%if(selhome_message4.isHasPreviousPage())
       out.print("<a href='selhome_message2.jsp?requestPage=previousPage'>上一页</a>"); %>
       <%if(selhome_message4.isHasNextPage())
       out.print("<a href='selhome_message2.jsp?requestPage=nextPage'>下一页</a>"); %>
  	<%-- 分页显示--%>
     <%
         List notes=selhome_message4.getCurrentPageList();
           for(int m=0;m<notes.size();m++){ 
            Mes_data note=(Mes_data)notes.get(m);
            selhome_message3.setmessage(note);
            String name =selhome_message1.getName(selhome_message3.getId_Use_Post());
            out.print("<tr align=center height=30>");
             out.print("<td width=259>"+selhome_message3.getCon_Message()+"</td>");
             %>
            <td align = center  width=88><a href="othhome_main.jsp?IDoth=<%= selhome_message3.getId_Use_Post()%>&IDseloth=<%=Id1%>&mk=0"><%=name%> </a></td>
            <%out.print("<td width=88>"+selhome_message3.getTim_Message()+"</td>");
            int mark=selhome_message3.Mes_function_check__rel(selhome_message3.getID());
            if(mark==0){
            %>
            <td width=80><a href="#" onclick="return openstr2(<%=selhome_message3.getID()%>,<%=Id1%>,<%=selhome_message3.getId_Use_Post()%>)">回复</a>|<a href=friend_message_delete.jsp?messageId=<%= selhome_message3.getID()%> onclick="return window.confirm('确定删除吗？');">删除</a></td>
           <%
           }
           else {
           %>
            <td width=80><a href="#" onclick="return openstr1(<%=selhome_message3.getID()%>)">我的回复</a>|<a href=friend_message_delete.jsp?messageId=<%= selhome_message3.getID()%> onclick="return window.confirm('确定删除吗？');">删除</a></td>
            <%
            }
            out.print("<br>");
            out.print("</tr>");
			}
	  %>
     </table>


</BODY> 
</html>